'\" te
.\" Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH INFOCMP 8 "Feb 17, 2023"
.SH NAME
infocmp \- compare or print out terminfo descriptions
.SH SYNOPSIS
.nf
\fB/usr/bin/infocmp\fR [\fB-d\fR] [\fB-c\fR] [\fB-n\fR] [\fB-I\fR] [\fB-L\fR] [\fB-C\fR] [\fB-r\fR] [\fB-u\fR]
     [\fB-s\fR | d | i | l | c] [\fB-v\fR] [\fB-V\fR] [\fB-1\fR] [\fB-w\fR \fIwidth\fR]
     [\fB-A\fR \fI directory\fR] [\fB-B\fR \fIdirectory\fR] [\fItermname\fR]...
.fi

.SH DESCRIPTION
\fBinfocmp\fR compares a binary \fBterminfo\fR entry with other terminfo
entries, rewrites a \fBterminfo\fR description to take advantage of the
\fBuse=\fR terminfo field, or prints out a \fBterminfo\fR description from the
binary file (\fBterm\fR) in a variety of formats. It displays boolean fields
first, then numeric fields, followed by the string fields. If no options are
specified and zero, or one \fItermname\fR is specified, the \fB-I\fR option is
assumed. If more than one \fItermname\fR is specified, the \fB-d\fR option is
assumed.
.SH OPTIONS
The \fB-d\fR, \fB-c\fR, and \fB-n\fR options can be used for
comparisons. \fBinfocmp\fR compares the \fBterminfo\fR description of the first
terminal \fItermname\fR with each of the descriptions given by the entries for
the other terminal's \fItermname\fR. If a capability is defined for only one of
the terminals, the value returned will depend on the type of the capability:
\fBF\fR for boolean variables, \fB\(mi1\fR for integer variables, and
\fINULL\fR for string variables.
.sp
.ne 2
.na
\fB\fB-d\fR\fR
.ad
.RS 6n
Produce a list of each capability that is different between two entries. This
option is useful to show the difference between two entries, created by
different people, for the same or similar terminals.
.RE

.sp
.ne 2
.na
\fB\fB-c\fR\fR
.ad
.RS 6n
Produce a list of each capability that is common between two entries.
Capabilities that are not set are ignored. This option can be used as a quick
check to see if the \fB-u\fR option is worth using.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.RS 6n
Produce a list of each capability that is in neither entry. If no
\fItermname\fR is given, the environment variable \fBTERM\fR will be used for
both of the \fItermname\fRs. This can be used as a quick check to see if
anything was left out of a description.
.RE

.sp
.LP
The \fB-I\fR, \fB-L\fR, and \fB-C\fR options will produce a
source listing for each terminal named.
.sp
.ne 2
.na
\fB\fB-I\fR\fR
.ad
.RS 6n
Use the \fBterminfo\fR names.
.RE

.sp
.ne 2
.na
\fB\fB-L\fR\fR
.ad
.RS 6n
Use the long C variable name listed in <\fBterm.h\fR>.
.RE

.sp
.ne 2
.na
\fB\fB-C\fR\fR
.ad
.RS 6n
Use the \fBtermcap\fR names. The source produced by the \fB-C\fR option may be
used directly as a \fBtermcap\fR entry, but not all of the parameterized
strings may be changed to the \fBtermcap\fR format. \fBinfocmp\fR will attempt
to convert most of the parameterized information, but anything not converted
will be plainly marked in the output and commented out. These should be edited
by hand.
.RE

.sp
.ne 2
.na
\fB\fB-r\fR\fR
.ad
.RS 6n
When using \fB-C\fR, put out all capabilities in \fBtermcap\fR form.
.RE

.sp
.LP
If no \fItermname\fR is given, the environment variable \fBTERM\fR will be used
for the terminal name.
.sp
.LP
All padding information for strings will be collected together and placed at
the beginning of the string where \fBtermcap\fR expects it. Mandatory padding
(padding information with a trailing '/') will become optional.
.sp
.LP
All \fBtermcap\fR variables no longer supported by \fBterminfo\fR, but are
derivable from other \fBterminfo\fR variables, will be displayed.  Not all
\fBterminfo\fR capabilities will be translated; only those variables which were
part of \fBtermcap\fR will normally be displayed. Specifying the \fB-r\fR
option will take off this restriction, allowing all capabilities to be
displayed in \fBtermcap\fR form.
.sp
.LP
Note that because padding is collected to the beginning of the capability, not
all capabilities are displayed. Mandatory padding is not supported. Because
\fBtermcap\fR strings are not as flexible, it is not always possible to convert
a \fBterminfo\fR string capability into an equivalent \fBtermcap\fR format. A
subsequent conversion of the \fBtermcap\fR file back into \fBterminfo\fR format
will not necessarily reproduce the original \fBterminfo\fR source.
.sp
.LP
Some common \fBterminfo\fR parameter sequences, their \fBtermcap\fR
equivalents, and some terminal types which commonly have such sequences, are:
.sp
.in +2
.nf
\fBterminfo     termcap\fR      Representative Terminals
\fB%p1%c	%.\fR	adm
\fB%p1%d	%d\fR	hp, ANSI standard, vt100
\fB%p1%'x'%+%c	%+x\fR	concept
\fB%i	%i\fR	ANSI standard, vt100
\fB%p1%?%'x'%>%t%p1%'y'%+%;	%>xy\fR	concept
\fB%p2\fR is printed before \fB%p1	%r\fR	hp
.fi
.in -2
.sp

.sp
.ne 2
.na
\fB\fB-u\fR\fR
.ad
.RS 6n
Produce a \fBterminfo\fR source description of the first terminal
\fItermname\fR which is relative to the sum of the descriptions given by the
entries for the other terminals' \fItermname\fRs. It does this by analyzing the
differences between the first \fItermname\fR and the other \fItermnames\fR and
producing a description with \fBuse=\fR fields for the other terminals. In this
manner, it is possible to retrofit generic \fBterminfo\fR entries into a
terminal's description. Or, if two similar terminals exist, but were coded at
different times, or by different people so that each description is a full
description, using \fBinfocmp\fR will show what can be done to change one
description to be relative to the other.
.RE

.sp
.LP
A capability is displayed with an at-sign (@) if it no longer exists in the
first \fItermname\fR, but one of the other \fItermname\fR entries contains a
value for it. A capability's value is displayed if the value in the first
\fItermname\fR is not found in any of the other \fItermname\fR entries, or if
the first of the other \fItermname\fR entries that has this capability gives a
different value for that capability.
.sp
.LP
The order of the other \fItermname\fR entries is significant. Since the
\fBterminfo\fR compiler \fBtic\fR does a left-to-right scan of the
capabilities, specifying two \fBuse=\fR entries that contain differing entries
for the same capabilities will produce different results, depending on the
order in which the entries are given. \fBinfocmp\fR will flag any such
inconsistencies between the other \fItermname\fR entries as they are found.
.sp
.LP
Alternatively, specifying a capability \fIafter\fR a \fBuse=\fR entry that
contains, it will cause the second specification to be ignored. Using
\fBinfocmp\fR to recreate a description can be a useful check to make sure that
everything was specified correctly in the original source description.
.sp
.LP
Another error that does not cause incorrect compiled files, but will slow down
the compilation time, is specifying superfluous  \fBuse=\fR fields.
\fBinfocmp\fR will flag any superfluous  \fBuse=\fR fields.
.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.RS 11n
Sorts the fields within each type according to the argument below:
.sp
.ne 2
.na
\fB\fBd\fR\fR
.ad
.RS 5n
Leave fields in the order that they are stored in the \fBterminfo\fR database.
.RE

.sp
.ne 2
.na
\fB\fBi\fR\fR
.ad
.RS 5n
Sort by \fBterminfo\fR name.
.RE

.sp
.ne 2
.na
\fB\fBl\fR\fR
.ad
.RS 5n
Sort by the long C variable name.
.RE

.sp
.ne 2
.na
\fB\fBc\fR\fR
.ad
.RS 5n
Sort by the \fBtermcap\fR name.
.RE

If the \fB-s\fR option is not given, the fields are sorted alphabetically by
the \fBterminfo\fR name within each type, except in the case of the \fB-C\fR or
the \fB-L\fR options, which cause the sorting to be done by the \fBtermcap\fR
name or the long C variable name, respectively.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 11n
Print out tracing information on standard error as the program runs.
.RE

.sp
.ne 2
.na
\fB\fB-V\fR\fR
.ad
.RS 11n
Print out the version of the program in use on standard error and exit.
.RE

.sp
.ne 2
.na
\fB\fB\(mi1\fR\fR
.ad
.RS 11n
Print the fields one to a line. Otherwise, the fields are printed several to a
line to a maximum width of 60 characters.
.RE

.sp
.ne 2
.na
\fB\fB-w\fR\fIwidth\fR\fR
.ad
.RS 11n
Changes the output to \fIwidth\fR characters.
.RE

.sp
.LP
The location of the compiled \fBterminfo\fR database is taken from the
environment variable \fB\fR\fBTERM\fR\fBINFO \fR. If the variable is not
defined, or the terminal is not found in that location, the system
\fBterminfo\fR database, usually in \fB/usr/share/lib/terminfo\fR, is used. The
options \fB-A\fR and \fB-B\fR may be used to override this location.
.sp
.ne 2
.na
\fB\fB-A\fR \fIdirectory\fR\fR
.ad
.RS 16n
Set \fB\fR\fBTERM\fR\fBINFO \fR for the first \fItermname\fR.
.RE

.sp
.ne 2
.na
\fB\fB-B\fR \fIdirectory\fR\fR
.ad
.RS 16n
Set \fB\fR\fBTERM\fR\fBINFO \fR for the other \fItermname\fRs. With this, it is
possible to compare descriptions for a terminal with the same name located in
two different databases. This is useful for comparing descriptions for the same
terminal created by different people.
.RE

.SH FILES
.ne 2
.na
\fB\fB/usr/share/lib/terminfo/?/*\fR\fR
.ad
.sp .6
.RS 4n
Compiled terminal description database.
.RE

.SH SEE ALSO
.BR curses (3CURSES),
.BR terminfo (5),
.BR attributes (7),
.BR captoinfo (8),
.BR tic (8)
